<template>
  <div class="boxes-wrap">
    <el-card
      class="box-card"
      v-for="item in weather"
      :key="item.id"
      :class="item.activated"
    >
      <img :src="item.img" />
      <div>
        <div v-if="item.display" class="invalid">{{ item.info }}</div>
        <div v-else class="box-right">
          <div class="something">
            <div class="info1">215</div>
            <div class="info-right">
              <div class="info2"></div>
              <div class="PM">PM2.5</div>
            </div>
          </div>
          <div class="info-center">
            <div class="info3">夜间多云</div>
            <div class="temp">25℃</div>
          </div>
          <div class="info-bottom">湿度10%东南风3-4级</div>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      weather: [
        {
          id: 1,
          img: require("../../assets/images/Shujufenxi/images/shujufenxi_09.png"),
          info: "晴天",
          display: false, //激活状态需要改变的两个值
          activated: "today", //激活状态需要改变的两个值
        },
        {
          id: 2,
          img: require("../../assets/images/Shujufenxi/images/shujufenxi_03.png"),
          info: "多云",
          display: true,
        },
        {
          id: 3,
          img: require("../../assets/images/Shujufenxi/images/shujufenxi_18.png"),
          info: "下雨",
          display: true,
        },
        {
          id: 4,
          img: require("../../assets/images/Shujufenxi/images/shujufenxi_15.png"),
          info: "下雪",
          display: true,
        },
        {
          id: 5,
          img: require("../../assets/images/Shujufenxi/images/shujufenxi_06.png"),
          info: "刮风",
          display: true,
        },
      ],
    };
  },
};
</script>

<style lang="less" scoped>
.boxes-wrap {
  display: flex;
  justify-content: space-between;
}
.today {
  background-color: rgb(109, 133, 246);
  color: white;
}
.box-card {
  width: 19%;
  min-width: 212px;
  height: 108px;
  border-radius: 4px;
  /deep/.el-card__body {
    font-size: 14px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    .invalid {
      margin-left: 20px;
      font-size: 20px;
      font-weight: 600;
      color: rgb(66, 82, 118);
    }
    .box-right {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-right: -12px;
      .something {
        display: flex;
        margin-bottom: 10px;
        .info1 {
          font-size: 20px;
          margin-right: 10px;
        }
        .info-right {
          .info2 {
            height: 50%;
            width: 100%;
            background: url(../../assets/images/Shujufenxi/images/shujufenxi_12.png)
              no-repeat;
          }
          .PM {
            font-size: 12px;
          }
        }
      }
      .info-center {
        display: flex;
        margin-bottom: 10px;
        .temp {
          font-size: 12px;
          margin-left: 10px;
        }
      }
      .info-bottom {
        font-size: 14px;
      }
    }
  }
}
</style>